<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
	</head>

	<body>
		<div class="mui-content">
			<div style="width:90%;margin: 0 auto;padding-top: 38px;">
				<textarea id="keywords" style="width:100%;height:128px;" placeholder="请输入你的问题！"></textarea>
			</div>
			<div style="width:90%;margin: 0 auto;">
				<button type="button" id="submitBtn" style="width:100%;" class="mui-btn">机器人解答</button>
			</div style="width:90%;margin: 0 auto;">
			<div style="width:90%;margin: 0 auto;background: #FFFFFF;margin-top: 38px;" id="robot">
				<p style="line-height: 1.8em;font-size:15px;padding: 10PX;">

				</p>
			</div>
		</div>
		<script type="text/javascript" src="../js/lib/mui.min.js"></script>
		<script type="text/javascript" src="../js/lib/h.min.js" ></script>
		<script type="text/javascript" src="../js/util.js"></script>
		<script type="text/javascript">
			mui.init();
			var _index,_self,_next;
			mui.plusReady(function() {
				dragHandler(1);
				h('#submitBtn').tap(function() {
					var keywords = h('#keywords').val();
					if(keywords.length < 1) {
						mui.toast('请输入要翻译的文本！');
						return false;
					}
					mui.getJSON(
						'http://www.tuling123.com/openapi/api', {
							key: 'b946ad4927a840859e1073e0e815ba3c',
							info: keywords
						},
						function(data) {
							console.log(JSON.stringify(data));
							h('#robot').find('p').html(data.text);
							h('#robot').show();
						}
					);
				});
			});
		</script>
	</body>

</html>